load("@rules_cc//cc:defs.bzl", "cc_binary")
load("//bzl:cpp_unittest.bzl", "cpp_unittest")

cpp_unittest(
    name = "nested_command_line_app_test",
    srcs = ["NestedCommandLineAppTest.cpp"],
    env = {
        "FOLLY_NESTED_CMDLINE_HELPER": "$(rootpath :nested_command_line_app_test_helper)",
    },
    deps = [
        ":nested_command_line_app_test_helper",
        "//folly:subprocess",
        "//folly/cli:program_options",
        "//folly/experimental/io:fs_util",
        "//folly/portability:gtest",
        "@glog",
    ],
)

cc_binary(
    name = "nested_command_line_app_test_helper",
    srcs = ["NestedCommandLineAppTestHelper.cpp"],
    deps = [
        "//folly/cli:program_options",
        "//folly/portability:gflags",
    ],
)

cpp_unittest(
    name = "program_options_test",
    srcs = ["ProgramOptionsTest.cpp"],
    env = {
        "FOLLY_PROGRAM_OPTIONS_TEST_HELPER": "$(rootpath :program_options_test_helper)",
    },
    deps = [
        ":program_options_test_helper",
        "//folly:file_util",
        "//folly:subprocess",
        "//folly/cli:program_options",
        "//folly/experimental/io:fs_util",
        "//folly/portability:gtest",
        "@glog",
    ],
)

cc_binary(
    name = "program_options_test_helper",
    srcs = ["ProgramOptionsTestHelper.cpp"],
    deps = [
        "//folly:conv",
        "//folly/cli:program_options",
        "@glog",
    ],
)

cc_binary(
    name = "nested_command_line_app_example",
    srcs = ["NestedCommandLineAppExample.cpp"],
    deps = [
        "//folly:scope_guard",
        "//folly:string",
        "//folly/cli:program_options",
    ],
)
